{% extends "smra_portal/portal_template.html" %}
{% block page_id %}virt-meta{% endblock page_id %} 

{% load extras %}

{% block main %}
<div class="page_title">Collection #{{currentvirt.pk}} - {{currentvirt.name}}</div>

<form action="" method="post">
{% csrf_token %}

<div class="schema_set">
            {% for v in virtdescform %}
            <div>
                <span class="data_label">{{v.label_tag}}</span>
                {% if owner %}
                    <span class="data_input">{{v}}</span>
                {% else %}
                    <span class="data_value">{{v.value}}</span>
                {% endif %}            
             <!--    {% if owner %}
                <span class="help">&nbsp;</span>
                {% endif %}
                -->        
            </div>
            {% endfor %}
		{% for label,field in virtformdata %}
    	<div>
            {% if not label.0 == "Key" and not label.0 == "Source" and not label.0 == "Group" and not label.0 == "profile" and not label.0 == "party_id" and not label.0 == "relationtocollection_id" and not label.0 == "Subject" %}
        	   <span class="data_label">{{label.0}}&nbsp;:</span>
       		   {% if owner %}
           		   <span class="data_input">{{field}}</span>
       		   {% else %}
           		   <span class="data_value">{{field.value}}</span>            
       		   {% endif %}
          <!--        {% if owner %}
                <span class="help">{{label.1}}</span>
                {% endif %}
                -->
            {% endif %}
        </div>
		{% endfor %}

		<div>
    		<span class="data_label">Created&nbsp;:</span>  
    		<span class="data_value">{{currentvirt.created_time}} </span>
		</div>

		<div>
    		<span class="data_label">Updated&nbsp;:</span>
    		<span class="data_value">{{currentvirt.update_time}}</span>        
    		{% if currentvirt.public and owner%}
    		{% if harvest.ingested_time == None or currentvirt.update_time > harvest.ingested_time %}    
        		<span class="data_value highlight">(Changed since last ingestion)</span>
    		{% endif %}        
    		{% endif %}   
		</div> 
    
		{% if currentvirt.public and owner %}
    	<div>
        	<span class="data_label">Ingested&nbsp;:</span>
        	<span class="data_value">
        		{% if harvest.ingested_time %}
        			{{harvest.ingested_time}}
        		{% else %}
        			Never
        		{%endif%}
        	</span>    
    	</div>
		{% endif %}
	&nbsp;
</div>

{% if virtobjects.object_list %}
<div  class="schema_set">
	<h1>Media Objects in this Collection</h1>

	<table class="row_set"> 
    	{% for obj in virtobjects.object_list %}   
    	<tr class="{% cycle 'row_odd' 'row_even' %}">     
        	<td>{{ obj }}</td>
  			<td><a href="{% url details pk=obj.pk %}">Details</a></td>
 		</tr>
    	{% endfor %}
	</table>
    {{ num_pages }}
	{% include "smra_portal/form_pagination.html" with records=virtobjects %}

 </div>
 
{% endif %}

{% endblock main %}


{% block leftbar %}
    {% if owner %}
    <h1>Actions</h1>
    
	<div class="button_row">
    	<button type ="submit" id="submit" name="update" value="update">Update Collection</button>  
    </div>   
    	{%if currentvirt.public %}
     	<div class="button_row">
     		<input type="submit" id="submit" name="makeprivate" 
     				value="Make Private">
     	</div>
     	{% else %}
    	<div class="button_row">
    		<a href="{% url virtpublish currentvirt.pk %}">Make Public</a>
    	</div>     	          
		{% endif %}
	{% endif %}
    
    <h1>Views</h1>
    <div class="button_row">
    	<a class="button_disabled" href="#">Details</a>
    </div>
    {% if owner %}
    	<div class="button_row"><a href="{% url virt currentvirt.pk %}">Objects</a></div>
    {% endif %}

	
</form>
	
{% endblock leftbar %}

